<div class="span9">	
	<!-- Modal -->    
	<div class="modal hide" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >
		<div class="modal-header">
			
			<h3 id="myModalLabel">Discover all the best daily deals!!!</h3>
			<br />
			<p>
				Never miss another deal at DealsCombined we do all the hard work for you. Sign up to receive personalised emails on the latest offers including theatre, spa and beauty and restaurants and lots more. 
			</p>
			<br />
			<h4>Just one detail about yourself:</h4>
		</div>
		<div class="modal-body">
			<div class="row-fluid">
				<div class="span4">
					<form class="form-horizontal" action="/">
						<div class="control-group">
							<label class="control-label" for="inputEmail">Email</label>
							<div class="controls">
								<input type="text" id="inputEmail" placeholder="Email">
							</div>
						</div>			
						<div class="control-group">
							<label class="control-label" for="inputCity">City</label>
							<div class="controls">
								<select id="inputCity">
									<?php foreach($this->components['cities'] as $city): ?>							
											<option value="<?php echo $city['id']?>" <?php if ($city['name'] == 'London') echo 'selected="selected"'?>><?php echo $city['name']; ?></option>
									<?php endforeach; ?>
								</select>
							</div>
						</div>		
					</form>
				</div>
			</div>
		</div>
		<div class="modal-footer">
			<button class="btn" data-dismiss="modal">
				Close
			</button>
			<button class="btn btn-primary" type="submit" id="send">
				Submit
			</button>
		</div>
	</div>

	<!--<div class="hero-unit">
		<h1>Main Deal!</h1>
		<p>
			This is a central place where you will be soon able to find the best deals of the web in only one place, so you won't have to wonder arround many deals websites.
		</p>
		<p>
			<a class="btn btn-primary btn-large">Learn more &raquo;</a>
		</p>
	</div>
-->
	
<div class="carousel slide" id="myCarousel">
                <ol class="carousel-indicators">
                	<?php $i=0; 
                		foreach ($this->components['deals'] as $temp): $i++?>
                  		<li data-slide-to="<?php echo $i; ?>" data-target="#myCarousel" class="<?php
						if ($i == 2)
							echo 'active';
						?>"></li>
                  		<?php endforeach; ?>
                </ol>
                <div class="carousel-inner">
          			<?php $i=1; 
	    	  			foreach($this->components['deals'] as $offer):?> 
	    					<div class="<?php if ($i++ == 2) echo 'active '?>item" style="background: url(<?php echo $offer['imageUrl'] ?>) no-repeat scroll 0px 4px /100% 417px transparent; height:417px; ">
	            				
	            				<div class="carousel-caption">
			                      	<h4><?php echo $offer['product_name']?></h4>
			                      	<p><?php echo $offer['description']?></p>
	           					 </div>
	    					</div>
	    			<?php endforeach; ?>
                  
                </div>
                <a data-slide="prev" href="#myCarousel" class="left carousel-control">‹</a>
                <a data-slide="next" href="#myCarousel" class="right carousel-control">›</a>
              </div>
			  <!--<div class="row-fluid center"><h2>Your sugested deals for today</h2></div>-->	
	
		<?php 	$i = 0;
				$last = count($this->components['deals']);
				
			foreach($this->components['deals'] as $offer): 
				$i++;
				
				?>
			<?php if ($i == 1):?><div class="row-fluid">
			<?php endif; ?>		
				
				<div class="span4 small-main-offer">
					<div class='subdeal-image'>
						<?php   $rand = (int) rand(1,count($this->keywords) -2);
								$alt = $this->keywords[$rand].' , '.$this->keywords[$rand + 1];?>
						<img alt="<?php echo $alt ?>" src="<?php echo $offer['imageUrl']?>" />
					</div>
					<div style="min-height: 68px;">
						<h3><?php echo $offer['product_name']?></h3>
					</div>
					<div style="min-height: 100px">
					<p>
						<?php echo $offer['description']?>
					</p>
					</div>
					<p>
						<a class="btn" target="_blank" href="<?php echo $offer['deep_link']?>">View details &raquo;</a>
					</p>
					<div class="bottom-offer">
		            	&nbsp;
		            </div>
				</div>
			<?php if ($i == 3 || $i == $last): $i =0;?>
			</div><br/><br />
			<?php endif; ?>	<!--/row-->
		<?php endforeach; ?><!--/span-->
	
</div><!--/span-->
<?php 	
	if(!isset($this->components['email'])): ?>
	<script type="text/javascript">
		$('#myModal').modal('toggle');
		
		$('#send').click(function(){
		 $.post(
			'subscription/update',
			{ email  : $('#inputEmail').val(),
			  cityId : $('#inputCity').val()
			},
			function(data){
				if (data == true){
					window.location = '/';
				}
				else if(data == 'registered'){
					window.location = '/index/index/message/overregistered/type/red';
				}
				else{
					alert(data);
				}
			},
		    'json'
			);
	});
	</script>
<?php endif; ?>	